import cv2
image=cv2.imread("mountain.png")    #读取原图像
image_Gray=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
#自适应阈值处理
athdMEAM=cv2.adaptiveThreshold(image_Gray,255,cv2.ADAPTIVE_THRESH_MEAN_C,cv2.THRESH_BINARY,5,3)
#高斯加权阈值处理
athdGAUS=cv2.adaptiveThreshold(image_Gray,255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C,cv2.THRESH_BINARY,5,3)
cv2.imshow('Input',image)       #显示原图像
cv2.imshow("image_Gray",image_Gray) #显示灰度图像
cv2.imshow("MEAN_C",athdMEAM)   #显示自适应阈值处理后的图像
cv2.imshow("GAUSSIAN_C",athdGAUS)
cv2.waitKey()
cv2.destroyAllWindows()